<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>CustomerLocation</title>
    </head>
    <body>
        <c:import url="header.jsp"/>
        <c:if test="${not empty sessionScope.customerLocationXML}">
            <x:parse var="customerLocation" xml="${sessionScope.customerLocationXML}"/>
        </c:if>
        <form action="ControllerServlet" type="get">
            <table>
                <tr>
                    <td style="width: 150px; height: 30px">
                        <p>id:</p>
                    </td>
                    <td>
                        <c:choose>
                            <c:when test="${param.type eq 'update'}">
                                <input hidden="true" name="id" value="<x:out select="$customerLocation/customerLocation/@id"/>"/>
                                <input disabled="true" style="width: 300px; height: 30px" 
                                       class="text" maxlength="16" type="text" name="id" id="id" 
                                       value="<x:out select="$customerLocation/customerLocation/@id"/>"/>
                            </c:when>
                            <c:when test="${param.type eq 'create'}">
                                <input style="width: 300px; height: 30px" 
                                       class="text" maxlength="16" type="text" name="id" id="id"/>
                            </c:when>
                        </c:choose>
                    </td>
                </tr>
                <tr>
                    <td style="width: 150px; height: 30px">
                        <p>Address:</p>
                    </td>
                    <td>
                        <input style="width: 300px; height: 30px" class="text" 
                               maxlength="16" type="text" name="address" id="address" 
                               value="<c:if test="${not empty customerLocation}"><x:out select="customerLocation/customerLocation/@address"/></c:if>"/>
                    </td>
                </tr>
                <tr>
                    <td style="width: 150px; height: 30px">
                        <p>CustomerId</p>
                    </td>
                    <td>
                        <input style="width: 300px; height: 30px" class="text" 
                               maxlength="16" type="text" name="customerId" id="customerId" 
                               value="<c:if test="${not empty customerLocation}"><x:out select="$customerLocation/customerLocation/@customerId"/></c:if>"/>
                    </td>
                </tr>
                <tr>
                    <c:choose>
                        <c:when test="${param.type eq 'update'}">
                            <td>
                                <input hidden="true" name="type" value="updateCustomerLocation"/>
                                <input style="width: 150px" type="submit" id="updateButton" class="button" value="OK"/>
                            </td>
                        </c:when>
                        <c:when test="${param.type eq 'create'}">
                            <td>
                                <input hidden="true" name="type" value="createCustomerLocation"/>
                                <input style="width: 150px" type="submit" id="createButton" class="button" value="Create"/>
                            </td>
                        </c:when>
                    </c:choose>
                </tr>
            </table>
        </form>
        <c:remove scope="session" var="customerLocationXML"/>            
    </body>
</html>
